﻿<UserControl x:Class="Quizzer.Views.CoursesPage"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:views="clr-namespace:Quizzer.Views"
             xmlns:vm="clr-namespace:Quizzer.ViewModel"
             mc:Ignorable="d">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="100"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="90"/>
        </Grid.ColumnDefinitions>

        <StackPanel Orientation="Vertical" Grid.Column="0">
            <Label Content="Courses" FontSize="20"/>
            
            <StackPanel Orientation="Vertical">
                <ListView ItemsSource="{Binding CoursesList}" 
                          SelectedItem="{Binding SelectedCourse}"
                          Margin="10,0,0,0" 
                          BorderThickness="0">
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <Label Content="{Binding Title}" Foreground="{Binding IsDone}"/>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
            </StackPanel>
        </StackPanel>
        
        <Grid Grid.Row="0" Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            
            <ListView ItemsSource="{Binding TestList}" 
                      SelectedItem="{Binding SelectedTest}" 
                      BorderThickness="0"
                      Grid.Row="0">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>

                            <StackPanel Orientation="Horizontal" Grid.Column="0">
                                <Label Content="{Binding Title}"
                                       FontSize="16"/>
                                <Label Content="Questions:" FontSize="16" Margin="15,0,0,0"/>
                                <Label Content="{Binding NumberOfQuestions}" 
                                       FontSize="16"/>
                                <Label Content="Attempts:" FontSize="16"/>
                                <Label Content="{Binding Attempts}" 
                                       FontSize="16"/>
                            </StackPanel>
                            <Rectangle Fill="{Binding IsTestDone}"
                                Grid.Column="1" 
                                Width="10" 
                                Height="25" />
                        </Grid>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>

            <StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Right">
                <Button Command="{Binding GoToTestPage}" 
                        Content="Info"
                        Background="White"
                        BorderThickness="0"
                        Width="70"
                        FontSize="16"/>
                <Button Command="{Binding BeginTest}" 
                        Content="Start"
                        Background="White"
                        BorderThickness="0"
                        Width="70"
                        FontSize="16"/>
            </StackPanel>
        </Grid>
        
        <StackPanel Grid.Row="0" Grid.Column="2"
                    HorizontalAlignment="Center">
            <StackPanel Orientation="Vertical">
                <Label Content="{Binding ProfileName}" 
                       FontSize="20" />
                <Image  Source="{Binding ProfileImage}" 
                        Width="80" 
                        Height="80" 
                        Margin="0,5,0,0"/>
                <Button Command="{Binding GoToProfilePage}"
                        Content="Profile" 
                        BorderThickness="0"
                        Background="White"
                        Margin="0,5,0,0"/>
            </StackPanel>
            
            <StackPanel Orientation="Vertical" Margin="0,10,0,0">
                <Label Content="{Binding ProfileProperty1}" Margin="0,5,0,0"/>
                <Label Content="{Binding ProfileProperty2}" Margin="0,5,0,0"/>
                <Label Content="{Binding ProfileProperty3}" Margin="0,5,0,0"/>
            </StackPanel>
            <!--Maybe some charts here or other info-->
        </StackPanel>
    </Grid>
</UserControl>
